package com.mfg.controller;

import com.mfg.util.CommonResult;
import com.mfg.service.WalletService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;

@RestController
public class WalletController {

    @Resource
    private WalletService walletService;

    /**
     *  根据用户id 查询钱包中的金额
     * @param userId
     * @return
     */
    @PostMapping("/getMoneyByWallet")
    public CommonResult getMoneyByWallet(@RequestParam("userId") Integer userId){
        BigDecimal money = walletService.getMoneyInWallet(userId);
        return new CommonResult(200, "查询成功", money);
    }





}
